///Project: Introducing GLP Paper Table 6
///Author: Erzen Oncel 
///Date: 31 May 2015 
///Stata 13

*************************TABLE 6***********************************************

**********************************English***************************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
count if power==1
count if power==3
count if office1==2
count if office1==7
count if office1==6
count if wealth==0
count if wealth==1
count if region==1
count if region==2
count if region==3
count if region==4
count if region==5
count if regime==0
count if regime==1
duplicates drop country_nid, force
count if wealth==0
count if wealth==1
count if region==1
count if region==2
count if region==3
count if region==4
count if region==5
count if regime==0
count if regime==1 

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen eng=0
replace eng=1 if english==1
gen noeng=0
replace noeng=1 if english==0
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/englishlang.dta", replace
clear all 
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/englishlang.dta", replace
count
collapse (sum) eng=eng noeng=noeng, by( country country_nid)
gen total=eng+noeng
gen prceng=eng/total*100
sum prceng
gen avgeng=r(mean)
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/english.dta",replace

**Apex**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/englishlang.dta"
keep if power==1
collapse (sum) eng=eng noeng=noeng, by( country country_nid)
gen total=eng+noeng
gen prceng=eng/total*100
sum prceng
**Top Ten**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/englishlang.dta"
keep if power==3
collapse (sum) eng=eng noeng=noeng, by( country country_nid)
gen total=eng+noeng
gen prceng=eng/total*100
sum prceng
**Cabinet**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/englishlang.dta"
keep if office1==2
collapse (sum) eng=eng noeng=noeng, by( country country_nid)
gen total=eng+noeng
gen prceng=eng/total*100
sum prceng
**Supreme Court**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/englishlang.dta"
keep if office1==7
collapse (sum) eng=eng noeng=noeng, by( country country_nid)
gen total=eng+noeng
gen prceng=eng/total*100
sum prceng
**MPs**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/englishlang.dta"
keep if office1==6
collapse (sum) eng=eng noeng=noeng, by( country country_nid)
gen total=eng+noeng
gen prceng=eng/total*100
sum prceng
**Wealth/Region/Regime**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/english.dta"
merge 1:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prceng if wealth==0
sum prceng if wealth==1
sum prceng if regime==0
sum prceng if regime==1
by region, sort: sum prceng 

***********************************French**************************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen fren=0
replace fren=1 if french==1
gen nofren=0
replace nofren=1 if french==0
//collapse (sum) french=nofrench, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/frenchlang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/frenchlang.dta"
collapse (sum) fren=fren nofren=nofren, by( country country_nid)
gen total=fren+nofren
gen prcfrench=fren/total*100
sort fren
sum prcfrench
gen avgfrench=r(mean)
sort prcfrench
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/french.dta", replace
**Apex**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/frenchlang.dta"
keep if power==1
collapse (sum) fren=fren nofren=nofren, by( country country_nid)
gen total=fren+nofren
gen prcfrench=fren/total*100
sum prcfrench
**Top Ten**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/frenchlang.dta"
keep if power==3
collapse (sum) fren=fren nofren=nofren, by( country country_nid)
gen total=fren+nofren
gen prcfrench=fren/total*100
sum prcfrench
**Cabinet**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/frenchlang.dta"
keep if office1==2
collapse (sum) fren=fren nofren=nofren, by( country country_nid)
gen total=fren+nofren
gen prcfrench=fren/total*100
sum prcfrench
**Supreme Court**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/frenchlang.dta"
keep if office1==7
collapse (sum) fren=fren nofren=nofren, by( country country_nid)
gen total=fren+nofren
gen prcfrench=fren/total*100
sum prcfrench
**MPs**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/frenchlang.dta"
keep if office1==6
collapse (sum) fren=fren nofren=nofren, by( country country_nid)
gen total=fren+nofren
gen prcfrench=fren/total*100
sum prcfrench
**Wealth/Region/Regime**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/french.dta"
merge 1:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcfrench if wealth==0
sum prcfrench if wealth==1
sum prcfrench if regime==0
sum prcfrench if regime==1
by region, sort: sum prcfrench

*************************************Spanish***********************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen span=0
replace span=1 if spanish==1
gen nospan=0
replace nospan=1 if spanish==0
//collapse (sum) span=nospan, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanishlang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanishlang.dta"
collapse (sum) span=span nospan=nospan, by (country country_nid)
gen total=span+nospan
gen prcspan=span/total*100
sum prcspan
gen avgspan=r(mean)
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanish.dta", replace
**Apex**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanishlang.dta"
keep if power==1
collapse (sum) span=span nospan=nospan, by( country country_nid)
gen total=span+nospan
gen prcspan=span/total*100
sum prcspan
**Next 10**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanishlang.dta"
keep if power==3
collapse (sum) span=span nospan=nospan, by( country country_nid)
gen total=span+nospan
gen prcspan=span/total*100
sum prcspan
**Cabinet**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanishlang.dta"
keep if office1==2
collapse (sum) span=span nospan=nospan, by( country country_nid)
sort span
gen total=span+nospan
gen prcspan=span/total*100
sum prcspan
**Supreme Court**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanishlang.dta"
keep if office1==7
collapse (sum) span=span nospan=nospan, by( country country_nid)
gen total=span+nospan
gen prcspan=span/total*100
sum prcspan
**MPs**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanishlang.dta"
keep if office1==6
collapse (sum) span=span nospan=nospan, by( country country_nid)
gen total=span+nospan
gen prcspan=span/total*100
sum prcspan
**Wealth/Region/Regime**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/spanish.dta"
merge m:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcspan if wealth==0
sum prcspan if wealth==1
sum prcspan if regime==0
sum prcspan if regime==1
by region, sort: sum prcspan

************************************Arabic*************************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen arab=0
replace arab=1 if arabic==1
gen noarab=0
replace noarab=1 if arabic==0
//collapse (sum) arab=noarab, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabiclang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabiclang.dta"
collapse (sum) arab=arab noarab=noarab, by (country country_nid)
gen total=arab+noarab
gen prcarab=arab/total*100
sum prcarab
gen avgarab=r(mean)
sort prcarab
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabic.dta", replace
**Apex**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabiclang.dta"
keep if power==1
collapse (sum) arab=arab noarab=noarab, by( country country_nid)
gen total=arab+noarab
gen prcarab=arab/total*100
sum prcarab
**Top Ten**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabiclang.dta"
keep if power==3
collapse (sum) arab=arab noarab=noarab, by( country country_nid)
gen total=arab+noarab
gen prcarab=arab/total*100
sum prcarab
**Cabinet**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabiclang.dta"
keep if office1==2
collapse (sum) arab=arab noarab=noarab, by( country country_nid)
gen total=arab+noarab
gen prcarab=arab/total*100
sum prcarab
**Supreme Court**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabiclang.dta"
keep if office1==7
collapse (sum) arab=arab noarab=noarab, by( country country_nid)
gen total=arab+noarab
gen prcarab=arab/total*100
sum prcarab
**MPs**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabiclang.dta"
keep if office1==6
collapse (sum) arab=arab noarab=noarab, by( country country_nid)
gen total=arab+noarab
gen prcarab=arab/total*100
sum prcarab
**Wealth/Region/Regime**
clear all
use  "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/arabic.dta"
merge m:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcarab if wealth==0
sum prcarab if wealth==1
sum prcarab if regime==0
sum prcarab if regime==1
by region, sort: sum prcarab

*************************************Chinese***********************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen chin=0
replace chin=1 if chinese==1
gen nochin=0
replace nochin=1 if chinese==0
//collapse (sum) chin =no chin, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chineselang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chineselang.dta"
collapse (sum) chin=chin nochin=nochin, by (country country_nid)
gen total= chin+nochin
gen prcchin= chin/total*100
sum prcchin
gen avgchin=r(mean)
sort prcchin
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chinese.dta", replace
**Apex**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chineselang.dta"
keep if power==1
collapse (sum) chin=chin nochin=nochin, by (country country_nid)
gen total= chin+nochin
gen prcchin= chin/total*100
sum prcchin
**Top Ten**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chineselang.dta"
keep if power==3
collapse (sum) chin=chin nochin=nochin, by (country country_nid)
gen total= chin+nochin
gen prcchin= chin/total*100
sum prcchin
**Cabinet**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chineselang.dta"
keep if office1==2
collapse (sum) chin=chin nochin=nochin, by (country country_nid)
gen total= chin+nochin
gen prcchin= chin/total*100
sum prcchin
**Supreme Court**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chineselang.dta"
keep if office1==7
collapse (sum) chin=chin nochin=nochin, by (country country_nid)
gen total= chin+nochin
gen prcchin= chin/total*100
sum prcchin
**MPs**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chineselang.dta"
keep if office1==6
collapse (sum) chin=chin nochin=nochin, by (country country_nid)
gen total= chin+nochin
gen prcchin= chin/total*100
sum prcchin
**Wealth/Region/Regime**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/chinese.dta"
merge m:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcchin if wealth==0
sum prcchin if wealth==1
sum prcchin if regime==0
sum prcchin if regime==1
by region, sort: sum  prcchin

*************************************Russian***********************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen rus=0
replace rus =1 if russian==1
gen norus=0
replace norus=1 if russian==0
//collapse (sum) rus=norus, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russianlang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russianlang.dta"
collapse (sum) rus=rus norus=norus, by (country country_nid)
gen total= rus+norus
gen prcrus=rus/total*100
sum prcrus
gen avgrus=r(mean)
sort prcrus
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russian.dta", replace
**Apex**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russianlang.dta"
keep if power==1
collapse (sum) rus=rus norus=norus, by (country country_nid)
gen total= rus+norus
gen prcrus=rus/total*100
sum prcrus
**Top Ten**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russianlang.dta"
keep if power==3
collapse (sum) rus=rus norus=norus, by (country country_nid)
gen total= rus+norus
gen prcrus=rus/total*100
sum prcrus
**Cabinet**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russianlang.dta"
keep if office1==2
collapse (sum) rus=rus norus=norus, by (country country_nid)
gen total= rus+norus
gen prcrus=rus/total*100
sum prcrus
**Supreme Court**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russianlang.dta"
keep if office1==7
collapse (sum) rus=rus norus=norus, by (country country_nid)
gen total= rus+norus
gen prcrus=rus/total*100
sum prcrus
**MPs**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russianlang.dta"
keep if office1==6
collapse (sum) rus=rus norus=norus, by (country country_nid)
gen total= rus+norus
gen prcrus=rus/total*100
sum prcrus
**Wealth/Region/Regime**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/russian.dta"
merge m:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcrus if wealth==0
sum prcrus if wealth==1
sum prcrus if regime==0
sum prcrus if regime==1
by region, sort: sum  prcrus

*************************************German************************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen ger=0
replace ger =1 if german==1
gen noger=0
replace noger=1 if german==0
//collapse (sum) ger=noger, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/germanlang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/germanlang.dta",
collapse (sum) ger=ger noger=noger, by (country country_nid)
gen total=ger+noger
gen prcger=ger/total*100
replace prcger =round(prcger)
sum prcger
gen avgger=r(mean)
sort prcger
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/german.dta", replace
**Apex**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/germanlang.dta",
keep if power==1
collapse (sum) ger=ger noger=noger, by (country country_nid)
gen total=ger+noger
gen prcger=ger/total*100
sum prcger
**Top Ten**
clear all
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/germanlang.dta",
keep if power==3
collapse (sum) ger=ger noger=noger, by (country country_nid)
gen total=ger+noger
gen prcger=ger/total*100
sum prcger
**Cabinet**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/germanlang.dta",
keep if office1==2
collapse (sum) ger=ger noger=noger, by (country country_nid)
gen total=ger+noger
gen prcger=ger/total*100
sum prcger
**Supreme Court**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/germanlang.dta",
keep if office1==7
collapse (sum) ger=ger noger=noger, by (country country_nid)
gen total=ger+noger
gen prcger=ger/total*100
sum prcger
**MPs**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/germanlang.dta",
keep if office1==6
collapse (sum) ger=ger noger=noger, by (country country_nid)
gen total=ger+noger
gen prcger=ger/total*100
sum prcger
**Wealth/Region/Regime**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/german.dta",
merge m:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcger if wealth==0
sum prcger if wealth==1
sum prcger if regime==0
sum prcger if regime==1
by region, sort: sum  prcger

********************************Portuguese*************************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen por=0
replace por =1 if portuguese==1
gen nopor=0
replace nopor=1 if portuguese==0
//collapse (sum) por=nopor, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/porlang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/porlang.dta"
collapse (sum) por=por nopor=nopor, by (country country_nid)
gen total=por+nopor
gen prcpor=por/total*100
sum prcpor
gen avgpor=r(mean)
sort prcpor
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/portuguese.dta", replace
**Apex**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/porlang.dta"
keep if power==1
collapse (sum) por=por nopor=nopor, by (country country_nid)
gen total=por+nopor
gen prcpor=por/total*100
sum prcpor
**Top Ten**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/porlang.dta"
keep if power==3
collapse (sum) por=por nopor=nopor, by (country country_nid)
gen total=por+nopor
gen prcpor=por/total*100
sum prcpor
**Cabinet**
clear all 
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/porlang.dta"
keep if office1==2
collapse (sum) por=por nopor=nopor, by (country country_nid)
gen total=por+nopor
gen prcpor=por/total*100
sum prcpor
**Supreme Court**
clear all 
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/porlang.dta"
keep if office1==7
collapse (sum) por=por nopor=nopor, by (country country_nid)
gen total=por+nopor
gen prcpor=por/total*100
sum prcpor
**MPs**
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/porlang.dta"
keep if office1==6
collapse (sum) por=por nopor=nopor, by (country country_nid)
gen total=por+nopor
gen prcpor=por/total*100
sum prcpor
**Wealth/Region/Regime**
clear all
use  "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/portuguese.dta"
merge m:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcpor if wealth==0
sum prcpor if wealth==1
sum  prcpor if regime==0
sum  prcpor if regime==1
by region, sort: sum  prcpor
************************************Other**************************************
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/GLP_mi_15 05 31.dta"
drop if missing(person_lang_all)
gen oth=0
replace oth =1 if otherlang==1
gen nooth=0
replace nooth=1 if otherlang==0
//collapse (sum) por=nopor, by(country_nid)
save"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlang.dta", replace
///calculate mean SD min max
clear all 
use"/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlang.dta"
collapse (sum) oth=oth nooth=nooth, by (country country_nid)
gen total=oth+nooth
gen prcother=oth/total*100
sum prcother
gen avgoth=r(mean)
sort prcother
save "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlanguage.dta", replace
**Apex**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlang.dta"
keep if power==1
collapse (sum) oth=oth nooth=nooth, by (country country_nid)
gen total=oth+nooth
gen prcother=oth/total*100
sum prcother
**Top Ten**
clear all
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlang.dta"
keep if power==3
collapse (sum) oth=oth nooth=nooth, by (country country_nid)
gen total=oth+nooth
gen prcother=oth/total*100
sum prcother
**Cabinet**
clear all 
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlang.dta"
keep if office1==2
collapse (sum) oth=oth nooth=nooth, by (country country_nid)
gen total=oth+nooth
gen prcother=oth/total*100
sum prcother
**Supreme Court**
clear all 
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlang.dta"
keep if office1==7
collapse (sum) oth=oth nooth=nooth, by (country country_nid)
gen total=oth+nooth
gen prcother=oth/total*100
sum prcother
**MPs**
clear all 
use "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlang.dta"
keep if office1==6
collapse (sum) oth=oth nooth=nooth, by (country country_nid)
gen total=oth+nooth
gen prcother=oth/total*100
sum prcother
**Wealth/Region/Regime**
clear all
use  "/Users/erzeno/Dropbox/GLP/VariousData/Data/Dataset/glp_mi/otherlanguage.dta"
merge m:1  country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta", keep(match)
sum prcother if wealth==0
sum prcother if wealth==1
sum  prcother if regime==0
sum  prcother if regime==1
by region, sort: sum  prcother
